package com.yazi.mxz.behavior.jackson.filter;

import java.util.HashSet;
import java.util.Set;

import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import com.yazi.mxz.behavior.entity.repository.Store;
import com.yazi.mxz.behavior.entity.repository.StoreGoods;
import com.yazi.mxz.behavior.entity.repository.StoreGoodsAccess;

public abstract class StoreGoodsAccessFilter {

	public static FilterProvider getWithStoreGoodsAndStore() {

		final Set<String> storeGoodsAccess = new HashSet<String>();
		storeGoodsAccess.add("storeGoods");
		
		final Set<String> storeGoods = new HashSet<String>();
		storeGoods.add("storeGoodsId");
		storeGoods.add("store");
		storeGoods.add("pic");
		storeGoods.add("title");
		storeGoods.add("subTitle");
		storeGoods.add("price");
		storeGoods.add("originalPrice");
		storeGoods.add("atDiscount");
		storeGoods.add("unit");
		storeGoods.add("sellUnit");
		storeGoods.add("unitConvert");
		storeGoods.add("stock");
		storeGoods.add("stockConvert");
		storeGoods.add("sellMin");
		storeGoods.add("sellExt");
		storeGoods.add("dealAll");
		
		final Set<String> store = new HashSet<String>();
		store.add("storeId");
		store.add("name");
		store.add("loc");
		
		return new SimpleFilterProvider()
				.addFilter(StoreGoodsAccess.class.getSimpleName(),
						SimpleBeanPropertyFilter.filterOutAllExcept(storeGoodsAccess))
				.addFilter(StoreGoods.class.getSimpleName(),
						SimpleBeanPropertyFilter.filterOutAllExcept(storeGoods))
				.addFilter(Store.class.getSimpleName(),
						SimpleBeanPropertyFilter.filterOutAllExcept(store));
	}

}
